package myjava.test.ui.model;

import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JPanel;

public class FreeJPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 鼠标滑过的颜色
	 */
	private Color honerColor;
	
	/**
	 * 鼠标离开的颜色
	 */
	private Color panelColor;
	
	public FreeJPanel() {
		super();
		this.honerColor = Color.WHITE;
		this.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				setBackground(honerColor);
			}
			
			@Override
			public void mouseExited(MouseEvent e) {
				setBackground(panelColor);
			}
		});
	}
	
	public void setHonerColor(Color color){
		this.honerColor = color;
	}
	
	public void setPanelColor(Color panelColor) {
		this.panelColor = panelColor;
	}

}
